package com.heima.wemedia.listen;

import com.heima.common.constants.message.NewsAutoScanConstants;
import com.heima.wemedia.service.WmNewsAutoScanService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @package com.heima.model.listen
 * @Date 2022/3/3
 * @project heima-leadnews
 */
@Component
@Slf4j
public class WemedisNewsAutoLidtener {
    @Autowired
    WmNewsAutoScanService wmNewsAutoScanService;

    @RabbitListener(queuesToDeclare = {
            @Queue(name= NewsAutoScanConstants.WM_NEWS_AUTO_SCAN_QUEUE)
    })
    public void newsAutoScanHandler(String newsId){
      log.info("接收到 自动审核的的消息==》{}",newsId);
      wmNewsAutoScanService.autoScanWmNews(Integer.valueOf(newsId));
    }

}
